﻿#ifndef __COMMON_H__
#define __COMMON_H__
#include <string>


typedef union                                        
{
   float ul_Temp;
   unsigned char  uc_Buf[4];
}un_DtformConver;

#ifdef _TEST_

#define tPrint(format,...) {printf(format,##__VA_ARGS__);}

#else 
#define tPrint(format,...)      ; 
#endif

int debug_print(const char *buf, int len);
unsigned short Reversal16(unsigned short data);
void ReversalArray(unsigned char * data, int len);
unsigned short sumCheck(unsigned char  *data, int len);
unsigned char CheckSum(unsigned char *buf, int len);
int debug_printf(const char *buf, int len, const char *pmsg);

unsigned char kstar_length_sumCheck(const unsigned char  *data);
unsigned short kstar_msg_sumCheck(const unsigned char  *data, int len);

void StringReplace(std::string &strBase, const std::string &strSrc, const std::string &strDes);
void EncodeEscape(const std::string srcStr, std::string &destStr);
void DecodeEscape(const std::string srcStr, std::string &destStr);
































#endif
